package com.baizhi.wxt.controller;

import com.baizhi.wxt.entity.User;
import com.baizhi.wxt.service.UserServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Map;

@Controller
@RequestMapping("user")
@CrossOrigin
public class UserController {

    @Autowired
    private UserServiceImpl userService;

    @RequestMapping("queryAllPage")
    @ResponseBody
    public Map<String,Object> queryAllPage(int page,int pageSize){
        return userService.queryAllPage(page, pageSize);
    }


    @RequestMapping("update")
    @ResponseBody
    public Map<String,Object> update(@RequestBody User user){
        return userService.update(user);
    }

    //删除
    @RequestMapping("delete")
    @ResponseBody
    public Map<String,Object> delete(@RequestBody User user){
        return userService.delete(user);
    }

}
